From: Olivier Fourdan Date: Wed, 19 Jan 2022 09:15:51 +0000 (+0100) Subject: util: Restore the NOFILE limit before spawning apps X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~530^2^2~106 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=3fc7357e3fc65dfb33a327cee3f77a30ebae72f0;p=gnome-shell.git util: Restore the NOFILE limit before spawning apps Make sure the restore the original NOFILE limit prior to run the commands so those don't inherit from the raised value. Part-of: --- diff --git a/js/misc/util.js b/js/misc/util.js index da768566a..bea2cfe85 100644 --- a/js/misc/util.js +++ b/js/misc/util.js @@ -111,9 +111,16 @@ function spawnApp(argv) { function trySpawn(argv) { var success_, pid; try { - [success_, pid] = GLib.spawn_async(null, argv, null, - GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.DO_NOT_REAP_CHILD, - null); + [success_, pid] = GLib.spawn_async( + null, argv, null, + GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.DO_NOT_REAP_CHILD, + () => { + try { + global.context.restore_rlimit_nofile(); + } catch (err) { + } + } + ); } catch (err) { /* Rewrite the error in case of ENOENT */ if (err.matches(GLib.SpawnError, GLib.SpawnError.NOENT)) {